using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponRemote : WeaponBase
{
    [SerializeField] protected GameObject bulletPrefab;
    [SerializeField] protected Transform muzzle;

    public virtual void FireBullet(Vector2 attackDirection)
    {
        Vector2 fireDirection = attackDirection.normalized;

        //调用对象池实例，并通过回调函数初始话子弹，（设置子弹位置、设置子弹脚本）
        GameObject bullet = PoolManager.Instance.Get(bulletPrefab, (bullet) =>
        {
            bullet.transform.position = muzzle.position;

            bullet.GetComponent<Object_PlayerBullet>()?.SetupBullet(fireDirection, _damage, _weaponStat.GetMoveSpeed());
        });
    }
}
